<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2016/3/8
  Time: 13:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fun"%>
<html>
<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta name="renderer" content="webkit">
    <link href="${pageContext.request.contextPath}/static/css/common.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/bootstrap-3.3.5/css/bootstrap.min.css"
          rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/font-awesome-4.3.0/css/font-awesome.min.css"
          rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/layer/skin/layer.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/select2-4.0.0/dist/css/select2.min.css"
          rel="stylesheet"/>
    <script src="${pageContext.request.contextPath}/static/js/jquery-1.11.3.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/bootstrap-3.3.5/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/select2-4.0.0/dist/js/select2.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/global.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/layer/layer.js" type="text/javascript"></script>
     <script type="text/javascript"
            src="${pageContext.request.contextPath}/static/plugins/My97DatePicker/WdatePicker.js"></script>
			<style>
		.jqGrid_wrapper{*+margin-left:270px;}
	
		.lt,.col-sm-3,.col-sm-8{float:left}
		.form-group{*+overflow:hidden;}
		.form-group label{width:28%\9;*+width:20%;text-align:right\9;*+text-align:right;}
		.col-sm-8 .m-t2 {width:30%\9; *+width:36%;}
		.form-group .col-sm-8{width:66%\9;*+width:66%;}
		.form-group .form-control{*+width:95%;}
		.form-control{*+height:22px;}
		#sub{*+margin-right:10px;}
		.input-group .form-control{*+z-index:-1;}
		.upload{*+position:relative;}
		.btn-primary{*+position:absolute;*+left:431px;*+top:-35px;*+z-index:3;}
	</style>
</head>
<body>
<jsp:include page="../../top.jsp"></jsp:include>
<div class="right">
    <div class="jqGrid_wrapper">
    	<div class="col-sm-12">
    	<form class="form-horizontal m-t"  id="uploadForm">
           <a id="sure" onclick="sure()" hidden="true"></a>
	       <div class="form-group">
	            <label class="col-sm-3  control-label"><i class="require">*</i>APP名称:</label>
	            <div class="col-sm-8">
	                <input class="form-control" name="cname" size="30" placeholder="请填写APP应用名称，4-6字为佳"/>
	            </div>
	        </div>
	       	<div class="form-group">
	            <label class="col-sm-3  control-label"><i class="require">*</i>应用主色:</label>
	            <div class="col-sm-8">
	                <input class="form-control" name="themeColor" size="30" placeholder="请输入APP应用的主色调，如#11A20A"/>
	            </div>
	        </div>
	        <div class="form-group">
	            <label class="col-sm-3 col-sm-3 control-label">*应用logo:</label>
	            <div class="col-sm-8">
	                <div class="input-group">
	                    <input class="form-control " name="imgLogoFile_t" id='imgLogoFile_t' value=""  readonly size="30"/>
	                    <div class="input-group-addon upload">
	                        <input class="form-control uploadfile"  type="file" name="imgLogoFile" 
	                               style="position: absolute;width: 60px;opacity: 0;"/>
	                        <a class="btn btn-primary ">上传</a>
	                    </div>
	                </div>
	            </div>
	        </div>
	       <div class="form-group">
	            <label class="col-sm-3 col-sm-3 control-label">*540*960:</label>
	            <div class="col-sm-8">
	                <div class="input-group">
	                    <input class="form-control " name="imgLaunch1File_t" id='imgLaunch1File_t' value=""  readonly size="30"/>
	                    <div class="input-group-addon upload">
	                        <input class="form-control uploadfile"  type="file" name="imgLaunch1File" 
	                               style="position: absolute;width: 60px;opacity: 0;"/>
	                        <a class="btn btn-primary ">上传</a>
	                    </div>
	                </div>
	            </div>
	        </div>
	        <div class="form-group">
	            <label class="col-sm-3 col-sm-3 control-label">*720*1280:</label>
	            <div class="col-sm-8">
	                <div class="input-group">
	                    <input class="form-control " name="imgLaunch2File_t" id='imgLaunch2File_t' value=""  readonly size="30"/>
	                    <div class="input-group-addon upload">
	                        <input class="form-control uploadfile"  type="file" name="imgLaunch2File" 
	                               style="position: absolute;width: 60px;opacity: 0;"/>
	                        <a class="btn btn-primary ">上传</a>
	                    </div>
	                </div>
	            </div>
	        </div>
	       
	       <div class="form-group">
	            <label class="col-sm-3 col-sm-3 control-label">*1080*1920:</label>
	            <div class="col-sm-8">
	                <div class="input-group">
	                    <input class="form-control " name="" id='imgLaunch3File_t' value=""  readonly size="30"/>
	                    <div class="input-group-addon upload">
	                        <input class="form-control uploadfile"  type="file" name="imgLaunch3File" 
	                               style="position: absolute;width: 60px;opacity: 0;"/>
	                        <a class="btn btn-primary ">上传</a>
	                    </div>
	                </div>
	            </div>
	        </div>
	        
	        <div class="form-group">
	            <label class="col-sm-3 col-sm-3 control-label">*1125*2001:</label>
	            <div class="col-sm-8">
	                <div class="input-group">
	                    <input class="form-control " name="imgLaunch2File_t" id='imgLaunch4File_t' value=""  readonly size="30"/>
	                    <div class="input-group-addon upload">
	                        <input class="form-control uploadfile"  type="file" name="imgLaunch4File" 
	                               style="position: absolute;width: 60px;opacity: 0;"/>
	                        <a class="btn btn-primary ">上传</a>
	                    </div>
	                </div>
	            </div>
	        </div>
	        
	        
	        <div class="form-group">
	            <label class="col-sm-3 col-sm-3 control-label">*1500*2668:</label>
	            <div class="col-sm-8">
	                <div class="input-group">
	                    <input class="form-control " name="imgLaunch2File_t" id='imgLaunch5File_t' value=""  readonly size="30"/>
	                    <div class="input-group-addon upload">
	                        <input class="form-control uploadfile"  type="file" name="imgLaunch5File" 
	                               style="position: absolute;width: 60px;opacity: 0;"/>
	                        <a class="btn btn-primary ">上传</a>
	                    </div>
	                </div>
	            </div>
	        </div>
	        
	        <div class="form-group">
	            <label class="col-sm-3 col-sm-3 control-label">*640*960:</label>
	            <div class="col-sm-8">
	                <div class="input-group">
	                    <input class="form-control " name="imgLaunch2File_t" id='imgLaunch6File_t' value=""  readonly size="30"/>
	                    <div class="input-group-addon upload">
	                        <input class="form-control uploadfile"  type="file" name="imgLaunch6File" 
	                               style="position: absolute;width: 60px;opacity: 0;"/>
	                        <a class="btn btn-primary ">上传</a>
	                    </div>
	                </div>
	            </div>
	        </div>
	        
	        <div class="form-group">
	            <label class="col-sm-3 col-sm-3 control-label">*640*1136:</label>
	            <div class="col-sm-8">
	                <div class="input-group">
	                    <input class="form-control " name="imgLaunch2File_t" id='imgLaunch7File_t' value=""  readonly size="30"/>
	                    <div class="input-group-addon upload">
	                        <input class="form-control uploadfile"  type="file" name="imgLaunch7File" 
	                               style="position: absolute;width: 60px;opacity: 0;"/>
	                        <a class="btn btn-primary ">上传</a>
	                    </div>
	                </div>
	            </div>
	        </div>
	        
	        <div class="form-group">
	            <label class="col-sm-3 col-sm-3 control-label">*750*1334:</label>
	            <div class="col-sm-8">
	                <div class="input-group">
	                    <input class="form-control " name="imgLaunch2File_t" id='imgLaunch8File_t' value=""  readonly size="30"/>
	                    <div class="input-group-addon upload">
	                        <input class="form-control uploadfile"  type="file" name="imgLaunch8File" 
	                               style="position: absolute;width: 60px;opacity: 0;"/>
	                        <a class="btn btn-primary ">上传</a>
	                    </div>
	                </div>
	            </div>
	        </div>
	        
	        <div class="form-group">
	            <label class="col-sm-3 col-sm-3 control-label">*1242*2208:</label>
	            <div class="col-sm-8">
	                <div class="input-group">
	                    <input class="form-control " name="imgLaunch2File_t" id='imgLaunch9File_t' value=""  readonly size="30"/>
	                    <div class="input-group-addon upload">
	                        <input class="form-control uploadfile"  type="file" name="imgLaunch9File" 
	                               style="position: absolute;width: 60px;opacity: 0;"/>
	                        <a class="btn btn-primary ">上传</a>
	                    </div>
	                </div>
	            </div>
	        </div>
	        
	        <div class="form-group">
	            <label class="col-sm-3 col-sm-3 control-label">*广告图:</label>
	            <div class="col-sm-8">
	                <div class="input-group">
	                    <input class="form-control " name="imgLaunch2File_t" id='imgAdFile_t' value=""  readonly size="30"/>
	                    <div class="input-group-addon upload">
	                        <input class="form-control uploadfile"  type="file" name="imgAdFile" 
	                               style="position: absolute;width: 60px;opacity: 0;"/>
	                        <a class="btn btn-primary ">上传</a>
	                    </div>
	                </div>
	            </div>
	        </div>
	        
	         
	        <div class="form-group">
	            <label class="col-sm-3 col-sm-3 control-label">*关于我们:</label>
	            <div class="col-sm-8">
	                <div class="input-group">
	                    <input class="form-control " name="imgLaunch2File_t" id='aboutUsFile_t' value=""  readonly size="30"/>
	                    <div class="input-group-addon upload">
	                        <input class="form-control uploadfile"  type="file" name="aboutUsFile" 
	                               style="position: absolute;width: 60px;opacity: 0;"/>
	                        <a class="btn btn-primary ">上传</a>
	                    </div>
	                </div>
	            </div>
	        </div>
	        
	    </form>
	    <button class="btn btn-success form-control" id="sub" onclick="sure();return false;" style="width: 150px;">提交</button>
	</div>
    </div>
</div>
    

<script type="text/javascript">
	$("select").val('0');	

$(function () {

	$(".uploadfile").change(function () {
        var filename = $(this).val();
        var index = filename.lastIndexOf("\\");
        var name = $(this).attr("name");
        $("#" + name + "_t").val(filename.substring(index + 1));
    });
	
	$("#uploadLogoImg").change(function () {
        var filename = $(this).val();
        var index = filename.lastIndexOf("\\");
        $("input[name='contentLogoImg']").val(filename.substring(index + 1));
    });
        
})
    function sure(){
        	/* var androidVer = $("#androidVer").val();
        	var androidVerLimit = $("#androidVerLimit").val();
        	var androidVerTip = $("#androidVerTip").val();
        	var androidVerCode = $("#androidVerCode").val();
        	var iosVer = $("#iosVer").val();
        	var iosVerLimit = $("#iosVerLimit").val();
        	var iosVerTip = $("#iosVerTip").val();
        	var iosVerTip = $("#iosVerTip").val();
        	var WeChatSubscription = $("#WeChatSubscription").val();
			var WeChatSubId = $("#WeChatSubId").val();
			var WeChatProductId = $("#WeChatProductId").val();
			var WeChatEncodingAESKey = $("#WeChatEncodingAESKey").val();
			var iosUpdateUrl = $("#iosUpdateUrl").val();
        	
			if(((androidVer=='' || androidVerTip=='' || androidVerCode=='' ))&&(androidVer!='' || androidVerTip!='' || androidVerCode!='')){
				alert("Android版本填写时，必须同时填写Android版本号，Android更新提示和Android版本号code");
				return;
			}
			if(((iosVer=='' || iosVerTip=='' ))&&(iosVer!='' || iosVerTip!='' )){
				alert("iOS版本填写时，必须同时填写iOS版本号，iOS强制更新的版本号和iOS更新提示");
				return;
			}
			var reg =new RegExp("^\\d{1,9}\.\\d{1,9}\.\\d{1,9}$");
			if(androidVer!='' && !(reg.test(androidVer))){
	           	alert("Android版本号格式错误，必须含有2个小数点，小数前后都为数字");
		    	$("#sub").removeAttr("disabled");
		    	return;
	        }
			if(androidVerLimit!='' && !(reg.test(androidVerLimit))){
	           	alert("Android强制更新的版本号错误，必须含有2个小数点，小数前后都为数字");
		    	$("#sub").removeAttr("disabled");
		    	return;
	        }
			if(iosVer!='' && !(reg.test(iosVer))){
	           	alert("iOS版本号格式错误，必须含有2个小数点，小数前后都为数字");
		    	$("#sub").removeAttr("disabled");
		    	return;
	        }
			if(iosVerLimit!='' && !(reg.test(iosVerLimit))){
	           	alert("iOS强制更新的版本号错误，必须含有2个小数点，小数前后都为数字");
		    	$("#sub").removeAttr("disabled");
		    	return;
	        }
			if(!WeChatSubscription){
				alert("微信公众号名称不能为空");
				return;
			}
			if(!WeChatSubId){
				alert("微信公众号原始id不能为空");
				return;
			}
			if(!WeChatProductId){
				alert("微信产品的product_id不能为空");
				return;
			}
			if(!WeChatEncodingAESKey){
				alert("微信公众号的EncodingAESKey不能为空");
				return;
			}
			if(!WeChatToken){
				alert("微信公众号服务器配置token不能为空");
				return;
			} */
			
			var formData = new FormData($( "#uploadForm" )[0]); 
        	$.ajax({  
             url: '${pageContext.request.contextPath}/admin/appstoreCustom_edit.action' ,  
             type: 'POST',  
             data: formData,  
             async: false,  
             cache: false,  
             contentType: false,  
             processData: false,  
             success: function (result) {  
                  result = JSON.parse(result)
                  if (result.code == 1) {
                	  alert("保存成功");
                  }else{
                  	alert(result.msg);
                  }
             },  
             error: function (returndata) {  
                 alert(returndata);  
             }  
        	});
        }
</script>
</body>
</html>
